package com.bite.book.enums;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:DELL
 * Date:2025-06-03
 * Time:19:58
 */
//枚举
public enum BookStatus {
    DELEIE(0,"删除"),
    NORMAL(1,"可借阅"),
    FORBIDDEN(2,"不可借阅"),
    ;

    BookStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private Integer code;//状态码
    private String desc;//状态的描述

    /*根据code,返回描述信息*/
    public static BookStatus getDescByCode(Integer code){
        switch (code){
            case 0:return DELEIE;
            case 1:return NORMAL;
            case 2:
            default:
                return FORBIDDEN;
        }
    }

    public Integer getCode() {//不能用@Data,必须自己写
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
